
:MAIN
  @call :FIND_TRUNK ..
  @if defined PROJECT_ROOT goto :BUILDWND_OK

  @call :FIND_TRUNK ..\trunk
  @if defined PROJECT_ROOT goto :BUILDWND_OK

  @call :FIND_TRUNK ..\..\trunk
  @if defined PROJECT_ROOT goto :BUILDWND_OK

  @if not exist envconf.bat call configure.bat
  @call envconf.bat 2>nul

  :BUILDWND_OK

  @SET DEVTOOL_HOME=%CD%
  @PATH %PATH%;%DEVTOOL_HOME%

  @cmd / k

goto :EOF


:FIND_TRUNK

  @if not exist %1\tool goto :EOF

  @pushd %1\tool
  @  call buildwnd.bat init
  @popd

@goto :EOF
